package com.ruoyi.business.statistics.service.impl;/**
 * @author 李国臻
 * @date 2025/4/22 09:22
 */

import com.ruoyi.business.seaTotal.domain.SeaTotalData;
import com.ruoyi.business.seaTotal.mapper.SeaTotalDataMapper;
import com.ruoyi.business.statistics.domain.StatisticsData;
import com.ruoyi.business.statistics.service.ISeaStatisticsService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @Description
 *
 * @author 李国臻
 * @date 2025-04-22 09:22
 */
@Service
public class SeaStatisticsServiceImpl implements ISeaStatisticsService {
    @Resource
    private SeaTotalDataMapper seaTotalDataMapper;
    @Override
    public List<StatisticsData> selectStatisticsDataList(StatisticsData statisticsData) {
        List<StatisticsData> resultList = new ArrayList<>();
        StatisticsData resultStatisticsData=new StatisticsData();
        switch (statisticsData.getDateUnit()){
            case "0":
                //按天统计
                SeaTotalData seaTotalData = new SeaTotalData();
                seaTotalData.setStartDate(statisticsData.getStartDate());
                seaTotalData.setEndDate(statisticsData.getEndDate());
                //总数
                int totalCount = seaTotalDataMapper.selectSeaTotalDataCount(seaTotalData);
                resultStatisticsData.setTotalCount(String.valueOf(totalCount));
                List<SeaTotalData> seaTotalDataList = seaTotalDataMapper.selectSeaTotalDataList(seaTotalData);

                resultList.add(resultStatisticsData);
                break;
            case "1":
                //按月统计
                break;
            case "2":
                //按年统计
                break;
            default:
                break;
        }

        return resultList;
    }
}
